# Project:	MapReduce
# Author:	gong_libin
# Date:		2013_05_24

CC = g++
CFLAGS = -g -Wall
CFLAGS += -D_MR_TEST_

MR_ENV = $(shell pwd)
MR_BIN = $(MR_ENV)/bin
MR_INC = $(MR_ENV)/inc
MR_SRC = $(MR_ENV)/src
MR_UTL = $(MR_SRC)/MrUtl
MR_HUB = $(MR_SRC)/MrHub
MR_MAP = $(MR_SRC)/MrMap
MR_RED = $(MR_SRC)/MrRed

MR_GLIB = /usr/lib
MR_GINC = /usr/include/MrInc

export CC
export CFLAGS

export MR_ENV
export MR_BIN
export MR_INC
export MR_SRC
export MR_UTL
export MR_HUB
export MR_MAP
export MR_RED

export MR_GLIB
export MR_GINC

.PHONY: bin src test

all: bin src test

bin:
	if test -d $(MR_BIN); then true; else mkdir $(MR_BIN); fi;

src:
	$(MAKE) -C $(MR_UTL)
	$(MAKE) -C $(MR_HUB)
	$(MAKE) -C $(MR_MAP)
	$(MAKE) -C $(MR_RED)

test:
	$(MAKE) -C test

clean:
	$(MAKE) clean -C $(MR_UTL)
	$(MAKE) clean -C $(MR_HUB)
	$(MAKE) clean -C $(MR_MAP)
	$(MAKE) clean -C $(MR_RED)
	$(MAKE) clean -C test
	rm -rf $(MR_BIN)
